package com.ruan.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruan.openfeign.DeptCenterOpenfeign;
import com.ruan.pojo.Dept;
import com.ruan.pojo.Emp;
import com.ruan.query.EmpQuery;
import com.ruan.service.EmpService;
import com.ruan.vo.EmpVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

/**
 * @ClassName:EmpController
 * @Author:阮昇
 * @Description:
 * @Datetime: 2023/6/14 16:21
 **/
@RestController
@RequestMapping("/emp")
public class EmpController {

    @Autowired
    private EmpService empService;

    @RequestMapping("/getEmpVoList")
    public PageInfo<EmpVo> getEmpVoList(EmpQuery empQuery){

        //开启分页
        PageHelper.startPage(empQuery.getPageNum(),empQuery.getPageSize());

        List<EmpVo> empList = empService.getEmpList(empQuery);

        PageInfo<EmpVo> pageInfo = new PageInfo<>(empList);

        return pageInfo;

    }

}
